package com.ziyun.pop.mall.system.config;

import org.springframework.boot.web.server.ErrorPage;
import org.springframework.boot.web.server.ErrorPageRegistrar;
import org.springframework.boot.web.server.ErrorPageRegistry;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;

@Component
public class ErrorConfiguration implements ErrorPageRegistrar {
	@Override
	public void registerErrorPages(ErrorPageRegistry registry) {
		ErrorPage[] errorPages = new ErrorPage[] { new ErrorPage(HttpStatus.NOT_FOUND, "/error/notFound.do")// 404
				// new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/error/error.do"), // 500
				// new ErrorPage(NullPointerException.class, "/error/nullPointer.do") // 空指针
		};

		registry.addErrorPages(errorPages);
	}
}
